package com.juzipi.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.juzipi.demo.pojo.Users;
import com.juzipi.demo.vo.UserBO;
import org.apache.ibatis.annotations.Select;


public interface UsersMapper extends BaseMapper<Users> {


    //连表查
//    @Select("select * from user as u left join role as r on r.id = u.roleId where u.username = #{username}")
    //大坑，注意手写sql的时候在没配置的情况下，要用数据库的原字段
    @Select("select * from user as u left join role r on r.id = u.role_id where u.username = #{username}")
    UserBO queryUserAndRole(String username);


    @Select("select * from user as u left join role r on r.id = u.role_id")
    Page<UserBO> queryUserRoleByPage(Page pageInfo);
}
